<template>
  <div class="typecon">
    <Typezi
      v-for="(v, i) in arr"
      :key="i"   
      :imgurl="v.imgurl" 
      :typeid="v.typeid"    
    />
  </div>
</template>

<script>
import { getlink } from "@/api/getapi.js";
import Typezi from "@/components/flower/typezi";
export default {
  components: {
    Typezi,
  },
  data() {
    return {
      arr: [],
      arrtypeid:[]
    };
  },
  created() {
    // getlink("/demo/flowertype").then((ok) => {
    //   this.arr = ok.data.flowertype;
    // });

     getlink("http://180.76.121.47:8008/flower").then((ok) => {
      //  console.log(ok);
     //给typeid去重
     ok.data.data.forEach(v=>{
    if(!this.arrtypeid.includes(v.typeid)){
        this.arrtypeid.push(v.typeid);
        this.arr.push(v)
        }
     }) 
    });
  },
};
</script>

<style scoped>
.typecon{
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}
</style>